﻿CREATE TABLE [dbo].[Receipt] (
    [id]              INT              IDENTITY (1, 1) NOT FOR REPLICATION NOT NULL,
    [RID]             VARCHAR (50)     CONSTRAINT [DF_Receipt_RID] DEFAULT ('') NULL,
    [CompanyId]       INT              CONSTRAINT [DF_Receipt_CompanyId] DEFAULT ((0)) NULL,
    [CompanyName]     NVARCHAR (200)   CONSTRAINT [DF_Receipt_CompanyName] DEFAULT ('') NULL,
    [CusName]         NVARCHAR (500)   CONSTRAINT [DF_Receipt_CusName] DEFAULT ('') NULL,
    [OrderId]         UNIQUEIDENTIFIER NULL,
    [NOE_Flag]        INT              NULL,
    [Je]              DECIMAL (18, 2)  CONSTRAINT [DF_Receipt_Je] DEFAULT ((0)) NULL,
    [PaymentTypeId]   INT              CONSTRAINT [DF_Receipt_PaymentTypeId] DEFAULT ((0)) NULL,
    [PaymentTypeName] NVARCHAR (50)    CONSTRAINT [DF_Receipt_PaymentTypeName] DEFAULT ('') NULL,
    [BankId]          INT              CONSTRAINT [DF_Receipt_BankId] DEFAULT ((0)) NULL,
    [BankName]        NVARCHAR (300)   CONSTRAINT [DF_Receipt_BankName] DEFAULT ('') NULL,
    [RDate]           DATETIME         NULL,
    [RItem]           NVARCHAR (300)   CONSTRAINT [DF_Receipt_RItem] DEFAULT ('') NULL,
    [Memo]            NVARCHAR (3000)  CONSTRAINT [DF_Receipt_Memo] DEFAULT ('') NULL,
    [LDate]           DATETIME         CONSTRAINT [DF_Receipt_LDate] DEFAULT (getdate()) NULL,
    [SUserName]       VARCHAR (20)     CONSTRAINT [DF_Receipt_LUserName1] DEFAULT ('') NULL,
    [SEName]          NVARCHAR (50)    CONSTRAINT [DF_Receipt_LEName1] DEFAULT ('') NULL,
    [LUserName]       VARCHAR (20)     CONSTRAINT [DF_Receipt_LUserName] DEFAULT ('') NULL,
    [LEName]          NVARCHAR (50)    CONSTRAINT [DF_Receipt_LEName] DEFAULT ('') NULL,
    [Flag]            INT              CONSTRAINT [DF_Receipt_Flag] DEFAULT ((0)) NULL,
    [CancelDate]      DATETIME         NULL,
    [CancelUserName]  VARCHAR (20)     CONSTRAINT [DF_Receipt_CancelUserName] DEFAULT ('') NULL,
    [CancelEName]     NVARCHAR (50)    CONSTRAINT [DF_Receipt_CancelEName] DEFAULT ('') NULL,
    [CancelMemo]      NVARCHAR (1000)  CONSTRAINT [DF_Receipt_CancelMemo] DEFAULT ('') NULL,
    [GroupFlag]       VARCHAR (50)     CONSTRAINT [DF_Receipt_GroupFlag] DEFAULT ('') NULL,
    CONSTRAINT [PK_Receipt] PRIMARY KEY CLUSTERED ([id] ASC)
);


GO
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'发票号', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'Receipt', @level2type = N'COLUMN', @level2name = N'RID';


GO
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'单位编号', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'Receipt', @level2type = N'COLUMN', @level2name = N'CompanyId';


GO
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'客户名称', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'Receipt', @level2type = N'COLUMN', @level2name = N'CusName';


GO
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'Order表GUID', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'Receipt', @level2type = N'COLUMN', @level2name = N'OrderId';


GO
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'成单类别：0：常规，1：非企，2：非常规', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'Receipt', @level2type = N'COLUMN', @level2name = N'NOE_Flag';


GO
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'金额', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'Receipt', @level2type = N'COLUMN', @level2name = N'Je';


GO
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'开发票的日期', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'Receipt', @level2type = N'COLUMN', @level2name = N'RDate';


GO
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'开票项目', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'Receipt', @level2type = N'COLUMN', @level2name = N'RItem';


GO
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'备注', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'Receipt', @level2type = N'COLUMN', @level2name = N'Memo';


GO
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'录入日期', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'Receipt', @level2type = N'COLUMN', @level2name = N'LDate';


GO
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'申票人工号', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'Receipt', @level2type = N'COLUMN', @level2name = N'SUserName';


GO
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'申票人姓名', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'Receipt', @level2type = N'COLUMN', @level2name = N'SEName';


GO
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'录入人工号', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'Receipt', @level2type = N'COLUMN', @level2name = N'LUserName';


GO
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'录入人姓名', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'Receipt', @level2type = N'COLUMN', @level2name = N'LEName';


GO
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'发票状态0:正常，1：作废', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'Receipt', @level2type = N'COLUMN', @level2name = N'Flag';


GO
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'发票作废时间', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'Receipt', @level2type = N'COLUMN', @level2name = N'CancelDate';


GO
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'作废操作人', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'Receipt', @level2type = N'COLUMN', @level2name = N'CancelUserName';


GO
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'发票作废人姓名', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'Receipt', @level2type = N'COLUMN', @level2name = N'CancelEName';


GO
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'作废原因', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'Receipt', @level2type = N'COLUMN', @level2name = N'CancelMemo';

